package com.liuh.okhttp.builder;

import java.io.File;

import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;

/**
 * @note 文件postBuilder构造
 * @author liuh
 * */
public class PostFileBuilder extends OkHttpRequestBuilder<PostFileBuilder> {

	private File file;
	private MediaType mediaType;

	public PostFileBuilder file(File file) {
		this.file = file;
		return this;
	}

	public PostFileBuilder mediaType(MediaType mediaType) {
		this.mediaType = mediaType;
		return this;
	}

	@Override
	public Request builderRequest() {
		Request.Builder mBuilder = builderBaseRequest().post(
				RequestBody.create(mediaType, file));
		return mBuilder.build();
	}
}
